package com.beesphere.excel.writer.impls.xml;

import java.io.OutputStream;

import com.beesphere.excel.writer.ExcelWriterException;
import com.beesphere.excel.writer.LineCell;
import com.beesphere.excel.writer.impls.AbstractExcelWriter;

public class XmlToExcelConverter extends AbstractExcelWriter {

	private static final long serialVersionUID = -2087889145695487742L;
	
	private OutputStream output;

	public XmlToExcelConverter (OutputStream output) throws ExcelWriterException {
		super ();
		this.output = output;
	}

	@Override
	protected void visitStart () throws ExcelWriterException {
	}

	@Override
	protected void visitStartSheet (int index) throws ExcelWriterException {
		
	}

	@Override
	protected void visitStartLine (int index) throws ExcelWriterException {
		
	}

	@Override
	protected void visitCell (LineCell cell, int index)
			throws ExcelWriterException {
	}

	@Override
	protected void visitEndLine () throws ExcelWriterException {
	}

	@Override
	protected void visitEndSheet () throws ExcelWriterException {
	}

	@Override
	protected void visitEnd () throws ExcelWriterException {
		try {
			wb.write (output);
			output.flush ();
		} catch (Throwable th) {
			throw new ExcelWriterException (th);
		} 
	}

	public void reset () {
		super.reset ();
		output = null;
	}
	
}
